package spring_mvc.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import spring_mvc.model.User;

import java.util.List;

@Repository
public interface UserMapper {
    @Select("select * from users")
    List<User> findAll();

    @Insert("insert into users values(#{user.name},#{user.sex})")
    int save(User user);

    @Update("update users set name = #{name},sex = #{sex} where id = #{id} ")
    int update(@Param("name") String name, @Param("sex") String sex, @Param("id") int id);

    @Delete("delete from users where id = #{id}")
    int delete(@Param("id") Integer id);
}
